package com.neusoft.elmboot.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import com.neusoft.elmboot.po.Food;

@Mapper
public interface FoodMapper {
	@Select("select food.*, " +
			"classify.classifyName as classifyName," +
			"ifnull(cart.quantity,0) as quantity from food " +
			"left join cart " +
			"on cart.userId = #{userId} " +
			"and cart.foodId = food.foodId "+
			"and cart.businessId=#{businessId} " +
			"left join classify  on food.classifyId = classify.classifyId " +
			"where food.businessId = #{businessId} " +
			"order by foodId")
	public List<Food> listFoodByBusinessId(Integer businessId,String userId);

	@Select("select * from food where foodId=#{foodId}")
	public Food getFoodById(Integer foodId);


}
